package com.gy.niuer.controller;

import com.gy.niuer.domain.User;
import com.gy.niuer.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
@CrossOrigin
@RequestMapping("/api/user")
public class UserController {
    @Autowired
    private UserService userService;

    @PostMapping
    public Boolean addUser(@RequestBody User user){
        return userService.addUser(user);
    }

    @PostMapping("/{idCard}")
    public User queryUser(@RequestBody User user){
        User a = userService.queryUser(user.getIdCard(), user.getName());
        System.out.println(user.getIdCard());
        return a;
    }
}
